﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace WebApplicationTestJs.Models
{
    /// <summary>
    /// 壓縮頁面css，js
    /// html標籤壓縮代碼被注釋，要自己啟用
    /// 支持：將頁面簡體轉換為繁體文本
    /// </summary>
    public class MyRazorViewEngine : RazorViewEngine
    { 
        protected override IView CreateView(ControllerContext controllerContext, string viewPath, string masterPath)
        {
            var url = controllerContext.HttpContext.Request.RawUrl;
            //压缩输出
            return new MyRazorView(controllerContext, viewPath, masterPath, true, base.FileExtensions, base.ViewPageActivator);
            
            //if (url == "/")
            //{
            //    //压缩输出
            //    return new MyRazorView(controllerContext, viewPath, masterPath, true, base.FileExtensions, base.ViewPageActivator);
            //}
            //else
            //{
            //    //不处理
            //    return new RazorView(controllerContext, viewPath, masterPath, true, base.FileExtensions, base.ViewPageActivator);
            //}
        }

    }
}